import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
Vue.use(VueRouter)
//用来解决 多次点击同一个标签页时报的错误
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
/*定义路由路径和视图之间的映射关系*/
const routes = [
    {
        path: '/',
        name: 'Login',
        redirect: "/login"
    },
    {   //登录页面
        path: "/login",
        name: "Login",
        component: () => import("@/views/Login")
    },
    {
        path: "/index",
        name: "Index",
        redirect: '/home',
        component: ()=>import("../views/Index.vue"),
        children:[

            {   //首页
                path: "/home",
                component: () => import("@/views/loginUser/Home"),
                meta:{ title:'首页', keepAlive:true }
            },

            //当前登录用户
            {   //个人中心
                path: "/person/personCenter",
                component: () => import("@/views/loginUser/PersonCenter"),
                meta:{ title:'个人中心', keepAlive:true }
            },
            {   //修改密码
                path: "/person/revisePassWord",
                component: () => import("@/views/loginUser/RevisePassWord"),
                meta:{ title:'修改密码', keepAlive:true }
            },


            {   //用户管理
                path: "/system/user",
                component: () => import("@/views/system/User")
            },
            {   //角色管理
                path: "/system/role",
                component: () => import("@/views/system/Role")
            },
            {   //菜单管理
                path: "/system/menu",
                component: () => import("@/views/system/Menu")
            },
            {   //科室管理
                path: "/system/dept",
                component: () => import("@/views/system/Dept")
            },
            {   //字典管理
                path: "/system/dict",
                component: () => import("@/views/system/Dict")
            },
            {   //通知公告
                path: "/system/notice",
                component: () => import("@/views/system/Notice")
            },
            {   //登录日志管理
                path: "/system/log_login",
                component: () => import("@/views/system/LoginLog")
            },
            {   //操作日志管理
                path: "/system/log_opt",
                component: () => import("@/views/system/OperateLog")
            },
            {   //检查费用设置
                path: "/system/ins_fee",
                component: () => import("@/views/system/InspectionFee")
            },
            {   //挂号费用设置
                path: "/system/reg_fee",
                component: () => import("@/views/system/RegistrationFee")
            },

            {   //字典数据路由
                path: "/dict/data/:dictId",
                component: () => import("@/views/system/DictData")
            },


        //    数据统计路由
            {   //收支统计
                path: "/statistics/revenue",
                name:'revenue',
                component: () => import("@/views/statistics/revenue/Revenue")
            },
            {   //药品销售统计
                path: "/statistics/sales",
                name:'sales',
                component: () => import("@/views/statistics/Sales")
            },
            {   //检查项目统计
                path: "/statistics/check",
                name:'check',
                component: () => import("@/views/statistics/Check")
            },
            {   //年月报表统计
                path: "/statistics/yearmonth",
                name:'yearmonth',
                component: () => import("@/views/statistics/Yearmonth")
            },
            {   //工作量统计
                path: "/statistics/workload",
                name:'workload',
                component: () => import("@/views/statistics/Workload")
            },


        //    药品进销存路由
            {   //厂家信息维护
                path: "/stock/producter",
                name:'producter',
                component: () => import("@/views/stock/Producter")
            },
            {   //药品信息维护
                path: "/stock/medicinal",
                name:'medicinal',
                component: () => import("@/views/stock/Medicinal")
            },
            {   //供应商维护
                path: "/stock/provider",
                name:'provider',
                component: () => import("@/views/stock/Provider")
            },
            {   //采购入库
                path: "/stock/purchase",
                name:'purchase',
                component: () => import("@/views/stock/Purchase")
            },
            {   //入库审核
                path: "/stock/examine",
                name:'examine',
                component: () => import("@/views/stock/Examine")
            },
            {   //库存查询
                path: "/stock/inventory",
                name:'inventory',
                component: () => import("@/views/stock/Inventory")
            },
            {//单据详情
                path: '/stock/editPurchase',
                component: () => import('@/views/stock/editPurchase'),
                name: 'editPurchase',
                // meta: { title: '采购入库修改', icon: 'list' }
            },
            {//新增采购
                path: '/stock/newPurchase',
                component: () => import('@/views/stock/newPurchase'),
                name: 'newPurchase',
                // meta: { title: '采购入库修改', icon: 'list' }
            },

        //    收费管理路由
            {   //处方收费
                path: "/charge/docharge",
                name:'docharge',
                component: () => import("@/views/charge/Docharge")
            },
            {   //收费列表
                path: "/charge/chargelist",
                name:'chargelist',
                component: () => import("@/views/charge/Chargelist")
            },
            {   //处方退费
                path: "/charge/backfee",
                name:'backfee',
                component: () => import("@/views/charge/Backfee")
            },
            {   //退费查询
                path: "/charge/backfeelist",
                name:'backfeelist',
                component: () => import("@/views/charge/Backfeelist")
            },
            {   //处方发药
                path: "/charge/dispensing",
                name:'dispensing',
                component: () => import("@/views/charge/Dispensing")
            },


        //    检查管理路由
            {   //新开检查
                path: "/check/docheck",
                name:'docheck',
                component: () => import("@/views/check/Docheck")
            },
            {   //新开检查
                path: "/check/checkresult",
                name:'checkresult',
                component: () => import("@/views/check/Checkresult")
            },
            {   //新开检查
                path: "/check/checklist",
                name:'checklist',
                component: () => import("@/views/check/Checklist")
            },

        //    看病就诊路由
            {   //门诊挂号
                path: "/doctor/registered",
                name:'registered',
                component: () => import("@/views/doctor/Registered")
            },
            {   //挂号列表
                path: "/doctor/registeredlist",
                name:'registeredlist',
                component: () => import("@/views/doctor/Registeredlist")
            },
            {   //新开就诊
                path: "/doctor/newcare",
                name:'newcare',
                component: () => import("@/views/doctor/Newcare")
            },
            {   //就诊列表
                path: "/doctor/carelist",
                name:'carelist',
                component: () => import("@/views/doctor/Carelist")
            },
            {   //我的排班
                path: "/doctor/myscheduling",
                name:'myscheduling',
                component: () => import("@/views/doctor/Myscheduling")
            },
            {   //医生排班
                path: "/doctor/scheduling",
                name:'scheduling',
                component: () => import("@/views/doctor/Scheduling")
            },
            {   //患者库
                path: "/doctor/patient",
                name:'patient',
                component: () => import("@/views/doctor/Patient")
            },
        ]
    },


]

const router = new VueRouter({
    routes
})

export default router
